import sys

import requests

from api.base import Login


class merProductCdkey(Login):
    # 查询
    def cdkey_library_page_list(self, name=None, productName=None):
        data = {
            'url': '/api/admin/merchant/cdkey/library/page/list',
            'method': 'get',
            'headers': {'Authori-zation': self._mer_token},
            'params': {
                'page': '1',
                'limit': '20',
                'name': name,
                'productName': productName,
                'temp': '1726676228',
            }
        }
        return self.mer_send_request(sys._getframe().f_code.co_name,data)

    # 新增卡密库
    def cdkey_library_save(self, name, remark):
        data = {
            'url': '/api/admin/merchant/cdkey/library/save',
            'method': 'post',
            'headers': {'Authori-zation': self._mer_token},
            'json': {
                'name': name,
                'remark': remark,
                'id': 0,
            }
        }
        return self.mer_send_request(sys._getframe().f_code.co_name,data)
